﻿using Microsoft.Xna.Framework;

namespace TroTro
{
    class Road : Sprite
    {
        public float Speed;

        public Road(Game game, float initialSpeed)
            : base(game)
        {
            Speed = initialSpeed;
        }

        public new void Update(GameTime gameTime)
        {
            Position.Y += Speed;
            CheckIfOffScreen();
        }

        private void CheckIfOffScreen()
        {
            if (Position.Y > 768)
                Position.Y = -700;
        }

        public void PutInStartPosition(int y)
        {
            Position.Y = y;
        }
    }
}
